from django.contrib.auth.mixins import LoginRequiredMixin
from django.http import JsonResponse

class LoginRequiredJSONMixin(LoginRequiredMixin):
    """
    def dispatch(self, request, *args, **kwargs):
        if not request.user.is_authenticated:
            return JsonResponse({"code": 0, "errmsg": "ok"})
        return super().dispatch(request, *args, **kwargs)
    """
    def handle_no_permission(self):
        return JsonResponse({"code": 0, "errmsg": "ok"})
